// GET请求
import {
	errdata
} from './errdata.js'

let listing = function(urling) {
	return new Promise((correct, wrong) => {
		uni.request({
			url: urling,
			method: 'GET',
		}).then((res) => {
			correct(res[1])
		}).catch((err) => {
			let errs = err.response
			errdata.errlist(errs)
			wrong(err)
		})
	})
}


// POST请求
let publicing = function(urling, Data) {
	return new Promise((correct, wrong) => {
		uni.request({
			url: urling,
			method: 'POST',
			data: Data
		}).then((res) => {
			correct(res[1])
		}).catch((err) => {
			let errs = err.response
			errdata.errlist(errs)
			wrong(err)
		})
	})
}

export {
	listing,
	publicing
}
